# Copyright 2006 Michael Gorsuch <michael@styledbits.com>

# This file is part of GrabTheMic <http://www.grabthemic.org>.

# GrabTheMic is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.

#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.

#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA


class AlertMailer < ActionMailer::Base

  def new_user(user)
    @subject    =" [GrabTheMic] #{user.name} has been created." 
    @body['user']       = user
    @recipients = ['michael.gorsuch@gmail.com']
    @from       = 'alerts@grabthemic.org'

  end

  def new_story(story)
    @subject    = " [GrabTheMic] #{story.user.name} has created #{story.title}."
    @body['story']       = story
    @recipients = ['michael.gorsuch@gmail.com']
    @from       = 'alerts@grabthemic.org'
  end
  
  def new_comment(comment)
    @subject    = " [GrabTheMic] #{comment.user.name} has posted a new comment about your story."
    @body['comment']       = comment
    @recipients = [comment.story.user.email]
    @from       = 'alerts@grabthemic.org'
  end

end
